package com.pdg.mcplugin.spawnsurance.commandprocessors;

import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.pdg.mcplugin.common.ArgumentList;
import com.pdg.mcplugin.common.baseclasses.CommandProcessorBase;
import com.pdg.mcplugin.spawnsurance.SpawnSurance;

public class CheckCommandProcessor extends CommandProcessorBase<SpawnSurance> {

	private static final String MESSAGE_COVERED = "You are covered!";
	private static final String MESSAGE_NOT_COVERED = "You are not covered!";

	public CheckCommandProcessor(SpawnSurance thePlugin) {
		super(thePlugin, new String[]{});
		// TODO Auto-generated constructor stub
	}

	@Override
	protected boolean specialProcessCommand(CommandSender theCommandSender,
			String theSubCommand, ArgumentList theArgumentList) {
		if(theCommandSender instanceof Player){
			Player thePlayer = (Player)theCommandSender;
			if(getPlugin().getDataProvider().isPlayerCovered(thePlayer)){
				getPlugin().sendInformationalMessage(theCommandSender, MESSAGE_COVERED);
			}else{
				getPlugin().sendWarningMessage(theCommandSender, MESSAGE_NOT_COVERED);
			}
			return true;
		}
		return false;
	}

}
